package homeWork05.Test1;

public class Point {
//    定义一个点类Point，包含2个成员变量x、y分别表示x和y坐标.
//    2个构造方法Point()和Point(int x0,y0).
//    以及一个movePoint（int dx,int dy）方法实现点的位置移动.
//    创建两个Point对象p1、p2，分别调用movePoint方法后，打印p1和p2的坐标。
      int x0;
      int y0;

      public Point(){}

      public Point(int x0,int y0){
          this.x0 = x0;
          this.y0 = y0;
      }

      public void movePoint(int dx , int dy){
          System.out.println("x"+x0+"-->"+(x0 + dx)+",y"+y0+"-->"+(y0 + dy));
          this.y0 = y0 + dy;
          this.x0 = x0 + dx;
      }

      public static void main( String[] args ){
          Point p1 = new Point(2,4);
          Point p2 = new Point(3,6);
          p1.movePoint(6,4);
          p2.movePoint(4,6);
      }
}
